textContent

abstract fun textContent(): String

Returns the text content of the current node and its descendants.

  • Returns an empty string if the node is one of the following types: DOCUMENT_NODE or DOCUMENT_TYPE_NODE.
  • Returns the node value if the node is a C_DATA_SECTION_NODE, COMMENT_NODE, PROCESSING_INSTRUCTIONS_NODE, or TEXT_NODE.
  • For other node types returns the concatenated text content of every child node, excluding comments and processing instructions. Returns an empty string if the current node has no children.

Throws

when this node is closed


abstract fun textContent(textContent: String)

Removes all the current node children and replaces them with a single text node with the given textContent.

Parameters

textContent

the new text content of the current node

Throws

when this node is closed